<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html lang="en">
	<head>
	<base href="<%=basePath%>"><!-- jsp文件头和头部 -->
	<%@ include file="../../system/main/main_top.jsp"%> 
    <link rel="stylesheet" media="screen" type="text/css" href="static/select2-js/select2.css" />
	</head>
<body>
<div id="centerOfMainFrame">
			<!-- 检索  -->
			<input type="hidden" name="lastStart" id="lastStart" value="${pd.lastStartShow }"/>
			<input type="hidden" name="lastEnd" id="lastEnd" value="${pd.lastEndShow }"/>
			<input type="hidden" name="keyword" id="keyword" value="${pd.keyword }"/>
			<input type="hidden" name="check_state" id="check_state" value="${pd.check_state }"/>
			<input type="hidden" name="status" id="status" value="${pd.status }"/>
			<table>
				<tr>
					<td style="vertical-align:top;">
						<a class='btn btn-mini btn-info' title="下载当前报表" onclick="exportExcel();" style="margin-top: 2px;">下载当前报表</a>
					</td>
				</tr>
			</table>
			<!-- 检索  -->
			<table id="table_report" class="table table-striped table-bordered table-hover" style="margin-top: 10px;">
				<thead>
					<tr>
						<th>邀请码</th>
						<th>推广员手机号码</th>
						<th>受邀注册用户手机号码</th>
						<th>注册时间-第一次扫码入桌时间差值（1小时有效）</th>
						<th>扫码经纬度与入场商户经纬度差值（1公里有效）</th>
						<th>注册终端串码</th>
						<th>受邀状态</th>
						<th>核算金额</th>
						<th>核算状态（已经扣款，暂未扣款。财务人员进行处理）</th>
						<th>创建时间</th>
					</tr>
				</thead>
										
				<tbody>
					
				<!-- 开始循环 -->	
				<c:choose>
					<c:when test="${not empty varList}">
						<c:forEach items="${varList}" var="var" varStatus="vs">
							<tr>
									<td>${var.invitation_code}</td>
									<td>${var.spread_mobile}</td>
									<td>${var.registger_mobile}</td>
									<td>${var.valid_time}</td>
									<td>${var.valid_range}(公里)</td>
									<td>${var.imei}</td>
									<td>
										<c:if test="${var.status == '1' }">有效</c:if>
										<c:if test="${var.status == '2' }">无效</c:if>
									</td>
									<td><fmt:formatNumber type="number" value="${var.amount == null ? '0.00' : var.amount} " maxFractionDigits="2"/></td>
									<td>
										<c:if test="${var.check_state == '1' }">未核算</c:if>
										<c:if test="${var.check_state == '2' }">已核算</c:if>
									</td>
									<td><fmt:formatDate value="${var.create_date}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
							</tr>
						</c:forEach>
						<!-- 
						<tr>
							<td colspan="100" class="center">您无权查看</td>
						</tr>
						 -->
					</c:when>
					<c:otherwise>
						<tr class="main_info">
							<td colspan="100" class="center" >没有相关数据</td>
						</tr>
					</c:otherwise>
				</c:choose>
				</tbody>
			</table>
			
			<div class="page-header position-relative">
				<table style="width:100%;">
					<tr>
						<td style="vertical-align:top;">
							<!-- <a class="btn btn-small btn-success" onclick="view(1);">查看</a> -->
						</td>
						<td style="vertical-align:top;"><div class="pagination" style="float: right;padding-top: 0px;margin-top: 0px;">${page.pageStr}</div></td>
					</tr>
				</table>
			</div>
	</div>
  	<div id="centerOfMainFrame2" class="center" style="display:none"><br/><br/><br/><br/><br/><img src="static/images/jiazai.gif" /><br/><h4 class="lighter block green">提交中...</h4></div>	
		<!-- 返回顶部  -->
		<a href="#" id="btn-scroll-up" class="btn btn-small btn-inverse">
			<i class="icon-double-angle-up icon-only"></i>
		</a>
		
		<!-- 引入 -->
		<script type="text/javascript">window.jQuery || document.write("<script src='static/js/jquery-1.9.1.min.js'>\x3C/script>");</script>
		<script type="text/javascript" src="static/js/bootstrap.min.js"></script>
		<script type="text/javascript" src="static/js/ace-elements.min.js"></script>
		<script type="text/javascript" src="static/js/ace.min.js"></script>
		<script type="text/javascript" src="static/select2-js/select2.js"></script>
		<script type="text/javascript" src="static/select2-js/select2.min.js"></script>
		<script type="text/javascript" src="static/select2-js/select2_locale_zh-CN.js"></script>
		<script type="text/javascript" src="static/js/chosen.jquery.min.js"></script><!-- 下拉框 -->
		<script type="text/javascript" src="static/js/bootbox.min.js"></script><!-- 确认窗口 -->	
		<script type="text/javascript" src="static/js/bootstrap-datepicker.min.js"></script><!-- 日期框 -->
		<!-- 引入 -->
		
		<script type="text/javascript">
		
		$(top.hangge());
		
		//下拉框
		$(".chzn-select").chosen(); 
		$(".chzn-select-deselect").chosen({allow_single_deselect:true}); 
		
		$(function() {
			//单选框
			$(".chzn-select").chosen(); 
			$(".chzn-select-deselect").chosen({allow_single_deselect:true}); 
			//日期框
			$('.date-picker').datepicker();
		});
		
		function exportExcel(){
			var lastStart = $("#lastStart").val();  
		    var lastEnd = $("#lastEnd").val();  
			var status = $("#status").val();
			var keyword = $("#keyword").val();
			var check_state = $("#check_state").val();
			window.location.href='<%=basePath%>/busiSpreadReport/exportExcelV2.do?lastStart='+lastStart+'&lastEnd='+lastEnd+'&status='+status+'&keyword='+keyword+'&check_state='+check_state;
		}
		</script>
	</body>
</html>

